﻿@model ContentResourceDto
@{
    var x = @Html.EasyUi();
}
<script type="text/javascript">
    var grid_contentResources_refresh = function () {
        $.easyui.refresh("formQuery_contentResources", "grid_contentResources");
    }

    var panel_contentResources_detail_refresh = function (id) {
        $.easyui.refreshPanel("panel_contentResources_detail", "/contentResources/content/DetailView?id=" + id);
    }

    var panel_contentResources_detail_onGridClickRow = function (index, row) {
        panel_contentResources_detail_refresh(row.Id);
    }

    var panel_contentResources_detail_onLoadSuccess = function (data) {
        if (data.total === 0) {
            panel_contentResources_detail_refresh("");
            return;
        }
        panel_contentResources_detail_refresh(data.rows[0].Id);
    }
</script>
@using (x.Layout(true).Begin())
{
    using (x.LayoutRegion().Top().Height(32).Begin())
    {
        <div class="toolbar">
            @x.DialogButton("添加内容资源", "/contentResources/content/add").Icon("icon-add").Plain().OnClose("grid_contentResources_refresh").DialogSize(1300, 850).Buttons("contentResources")
            @x.DialogButton("编辑内容资源", "/contentResources/content/edit").Id("btnEdit_contentResources").Icon("icon-edit").Plain().ShowEditDialog("grid_contentResources").OnClose("grid_contentResources_refresh").DialogSize(1300, 850)
            @x.Button("删除内容资源").Icon("icon-delete").Plain().Delete("/contentResources/content/delete", "", "grid_contentResources")
            @x.DialogButton("查看详细", "/contentResources/content/detail").Id("btnLook_contentResources").Icon("icon-look").Plain().ShowDetailDialog("grid_contentResources").DialogSize(1300, 850)
            @x.Button("刷 新").Icon("icon-refresh").Plain().Refresh("formQuery_contentResources", "grid_contentResources")
        </div>
    }
    using (x.LayoutRegion().Center().Begin())
    {
        @Html.Partial("Parts/QueryForm",new ContentResourceQuery())
        @(x.Grid("grid_contentResources").Sort("CreationTime").Toolbar("divQuery_contentResources").Url("/contentResources/content/PagerQuery")
           .ShowEditDialogByDblClick("btnEdit_contentResources").Menu().FitColumns().Fit()
           .Columns(
               x.GridColumn(t => t.Id).CheckBox(),
               x.GridColumn(t => t.Title, 200),
               x.GridColumn(t => t.Tags, 100),
               x.GridColumn(t => t.TypeDescription, 30),
               x.GridColumn(t => t.StateDescription, 30),
               x.GridColumn(t => t.CreationTime, 100)
           )
           .AddDataOption("onClickRow", "panel_contentResources_detail_onGridClickRow")
           .OnLoadSuccess("panel_contentResources_detail_onLoadSuccess")
        )
    }
 }